/*
 * Eugen Stoian <stoian.e@gmail.com> 2010
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef EXPRESSION3D_H
#define EXPRESSION3D_H
#include <QStringList>
#include <Object.h>
#include <ExpressionTreeNode.h>
class Expression3D:public Object
{
    Q_OBJECT
public:
    Expression3D(QObject *parent = 0);

    Expression3D(const QStringList& varList,
                 const QString& xExpression,
                 const QString& yExpression,
                 const QString& zExpression,
                 QObject *parent = 0);

    virtual Object* clone() const;

    const QStringList &variablesList() const;

    const QString& x() const;

    const QString& y() const;

    const QString& z() const;

    QString xSignature() const;

    QString ySignature() const;

    QString zSignature() const;

    QString xCode() const;

    QString yCode() const;

    QString zCode() const;

    SmartPtr<ExpressionTreeNode> xTree() const;

    SmartPtr<ExpressionTreeNode> yTree() const;

    SmartPtr<ExpressionTreeNode> zTree() const;

    friend QDataStream& operator<<(QDataStream& stream, const Expression3D& expr);

    friend QDataStream& operator>>(QDataStream& stream, Expression3D& expr);

public slots:
    void setVariablesList(const QStringList& varList);

    void setX(const QString& expr);

    void setY(const QString& expr);

    void setZ(const QString& expr);

    bool isValid() const;

signals:
    void changed();

private:
    QStringList _varList;
    QString _xExpression;
    QString _yExpression;
    QString _zExpression;
};

QDataStream& operator<<(QDataStream& stream, const Expression3D& expr);

QDataStream& operator>>(QDataStream& stream, Expression3D& expr);
#endif // EXPRESSION3D_H
